package cn.territory

object territoryUtil {

  //原始请求数
  def originlRequest(processnode:Int,requestmode:Int)={if( processnode >=1 && requestmode ==1){1}else{0}}
  //有效请求数
  def valueRequest(processnode:Int,requestmode:Int)={if( processnode >=2 && requestmode ==1){1}else{0}}
  //广告请求数
  def advertiseRequest(processnode:Int,requestmode:Int)={if( processnode ==3 && requestmode ==1){1}else{0}}
  //参与竞价数
  def biddingTime(iseffective:Int,isbilling:Int,isbid:Int,adorderid:Int)={if (iseffective =='1'&&  isbilling=='1' && isbid=='1' && adorderid !=0){
    1}else{0}}
  //竞价成功数
  def biddingSucess(iseffective:Int,isbilling:Int,iswin:Int)={if(iseffective == '1'&& isbilling=='1' && iswin =='1'){
    1} else{0}}
  //展示数
  def terminalShow(iseffective:Int,processnode:Int)={if(iseffective == '1' && processnode ==2){1}else{0}}
  //点击数
  def audienceClick(iseffective:Int,processnode:Int)={if(iseffective == '1' && processnode ==3){1}else{0}}
  //广告消费
  def  DSPAdvertiseConsuem(iseffective:Int,isbilling:Int,iswin:Int,winprice:Double)={if(iseffective =='1'&& isbilling=='1' && iswin =='1')
  {winprice/1000}else{0.0}}
  //广告成本
  def  DSPAdvertiseCos(iseffective:Int,isbilling:Int,iswin:Int,adpayment:Double)={if(iseffective =='1'&& isbilling=='1' && iswin =='1')
  {adpayment/1000}else{0.0}}

}
